class ResponseMiddleware {
    constructor() {
        this.middleware = this.middleware.bind(this);
    }

    middleware(req, res, next) {
        res.customResponse = (code, message, data = {}) => {
            const response = {
                code,
                message,
                data
            };
            res.status(code).json(response);
        };
        next();
    }
}

module.exports = ResponseMiddleware;
    